package behavioral.observer;

/**
 * @Description: 微信群成员
 * @Author: lxt
 * @CreateDate: 2019/11/1
 **/
public class Observer {
    private String name;

    public Observer(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void receive(String observer, String message) {
        System.out.println(name + " 收到了【" + observer + "】的信息：" + message);
    }

    public void sendMessagge(Subject subject, String message) {
        subject.sendMessage(this, message);
    }
}
